// enum HttpCode<I32, String> {
//     OK
// }

#[derive(Debug)]
struct ApiResponse<T> {
    code: i32,
    msg: Option<String>,
    data: Option<T>,
}

impl<T> ApiResponse<T> {
    fn new(code: i32, msg: Option<String>, data: Option<T>) -> Self {
        ApiResponse {
            code,
            msg,
            data,
        }
    }

    fn success(data: T) -> Self {
        ApiResponse {
            code: 200,
            msg: Option::from("成功".to_string()),
            data: Some(data),
        }
    }

    fn error(message: String) -> Self {
        ApiResponse {
            code: 404,
            msg: Option::from(message),
            data: None,
        }
    }
}